package com.company;

class Person implements Cloneable {
    private String name;
    private int age;
    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public void updateAge() {
        this.age ++;
    }

    public String toString() {
        return "[" + super.toString() + "] name:" + this.name + "& age:" + this.age;
    }

    public void introSelf() {
        System.out.println(this.toString());
    }

    @Override
    public Person clone() throws CloneNotSupportedException {
        return (Person)super.clone();
    }
}

public class JavaObjClone {
    public static void main(String[] args) throws Exception {
        Person liMing = new Person("MingLee", 20);
        Person mingLee = liMing.clone();
        liMing.updateAge();
        mingLee.introSelf();
        liMing.introSelf();
        int a = 20;

    }
}
